package com.ltkj.shop.domain.vo;

import com.ltkj.common.core.utils.bean.BeanUtils;
import com.ltkj.common.security.utils.DictUtils;
import com.ltkj.shop.domain.ShopRestaurantMenu;
import com.ltkj.system.api.domain.SysDictData;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.compress.utils.Lists;

import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * 餐饮菜品对象 shop_restaurant_menu
 *
 * @author xupf
 * @date 2023-09-04
 */
@ApiModel(value = "餐饮菜品")
@Data
public class ShopRestMenuVo extends ShopRestaurantMenu
{
    private static final long serialVersionUID = 1L;

    /** 轮播图 */
    @ApiModelProperty(value = "轮播图")
    private List<ShopImgVo> imgDetails = Lists.newArrayList();

    /** 种类名称 */
    @ApiModelProperty(value = "种类名称")
    private String typeName;

    public static ShopRestMenuVo fromDO(ShopRestaurantMenu restaurantMenu) {
        // 2023-10-09 类型从字典转为业务表
//        List<SysDictData> shopDishType = DictUtils.getDictCache("shop_dish_type");
//        Map<String, String> stringStringMap = shopDishType.stream().collect(Collectors.toMap(SysDictData::getDictValue, SysDictData::getDictLabel));
        ShopRestMenuVo shopRestMenuVo = new ShopRestMenuVo();
        BeanUtils.copyBeanProp(shopRestMenuVo, restaurantMenu);
//        shopRestMenuVo.setTypeName(stringStringMap.get(shopRestMenuVo.getType()));
        return shopRestMenuVo;
    }

}
